-module(ft).
-export([consult/1]).

consult(File) ->
    case file:open(File, read) of
        {ok, FileHandler} -> 
            Val = consult1(FileHandler),
            file:close(File),
            {ok, Val};
        {error, Reason} ->
            {error, Reason}
    end.

consult1(FileHandler) ->
    case io:read(FileHandler, '') of
        {ok, Term} -> [Term|consult1(FileHandler)];
        eof -> [];
        Error -> Error
    end.
